package com.example.logintest.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.logintest.mapper.ImagesUrlMapper;
import com.example.logintest.pojo.ImagesUrl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: Lemon
 * @Description: TODO
 * @Date: 2024/8/30 10:08
 */
@Service
public class IImagesServiceImpl implements IImagesService {

    @Resource
    private ImagesUrlMapper imagesUrlMapper;

    @Override
    public List<Map<String, Object>> queryImagesUrl() {
        List<Map<String, Object>> resultList = new ArrayList<>();
        List<ImagesUrl> imagesUrls = imagesUrlMapper.selectList(
                new LambdaQueryWrapper<ImagesUrl>()
                        .eq(ImagesUrl::getStatus, "1"));
        for (ImagesUrl imagesUrl:imagesUrls){
            Map<String, Object> resultMap = new HashMap<>();
            resultMap.put("url",imagesUrl.getUrl());
            resultList.add(resultMap);
        }
        return resultList;
    }
}
